package tt.com.feesmanager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tt.com.common.enums.Status;
import tt.com.common.enums.TollEnum;
import tt.com.common.model.DeadProject;
import tt.com.common.util.CommonResult;
import tt.com.common.util.PageUtil;
import tt.com.feesmanager.mapper.DeadprojectMapper;
import tt.com.feesmanager.service.SelectNeedbufei;

import java.util.List;

@Service
public class SelectNeedbufeiImpl extends ServiceImpl<DeadprojectMapper, DeadProject> implements SelectNeedbufei {
    @Override
    public CommonResult SelectNeedBufei(DeadProject deadProject, PageUtil pageUtil) {
        List<DeadProject> list = baseMapper.selectList(null);
        IPage<DeadProject> page = new Page<>(pageUtil.getPageIndex(),pageUtil.getPageSize());
        QueryWrapper<DeadProject> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("chargeable_status",TollEnum.PAYMENT_NEED_SUPPLEMENT);
        IPage<DeadProject> page1 = baseMapper.selectPage(page,queryWrapper);
        if (page1==null){
            return CommonResult.buildR(Status.DEFAULT,"查询结果为空");
        }else {
            return CommonResult.buildR(Status.OK,"查询成功，已返回查询结果",page1);
        }
    }
}
